﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Client Error Reporting</title>
</head>
<body>
    <div id="div1" style="height:100px;width:1000px;">
    </div>

    <script type="text/javascript">

        function addEventHandler(obj, event, delegHandler) {
            try {
                if (navigator.appName == 'Microsoft Internet Explorer') obj.attachEvent(event, delegHandler, false);
                else if ((navigator.appName == 'Netscape') || (navigator.appName == 'Opera')) {
                    event = event.substring(2, event.length);
                    obj.addEventListener(event, delegHandler, false);
                }
            } catch (Error) { return Error; }
        }
        function removeEventHandler(obj, event, delegHandler) {
            try {
                if (navigator.appName == 'Microsoft Internet Explorer') obj.detachEvent(event, delegHandler, false);
                else if ((navigator.appName == 'Netscape') || (navigator.appName == 'Opera')) {
                    event = event.substring(2, event.length);
                    obj.removeEventListener(event, delegHandler, false);
                }
            } catch (Error) { return Error; }
        }
        function ShowError(errorMSG, url, block, line) {
            if(typeof(block) == "function")
            {
                block = block.toString();
                block = block.substring(9, block.length);
                block = block.substring(0, block.toString().indexOf("("));
            }

            document.getElementById("div1").innerHTML += 
                "Error: " + errorMSG + "<br>, URL: " + url + "<br>, Block: " + block.toString() + "<br>, Line: " + line.toString() + "<br>";

            document.getElementById("div1").innerHTML += "-------------------------------------<br>";
        }
        function Test(){
            try {
                t.t();
            }
            catch(Error) {
                ShowError(Error.message, window.location.href, arguments.callee, "");
            }
        }

        window.onerror = function(msg, url, line) {
            ShowError(msg, url, window, line);
        };

        Test();

        h.t();

    </script>
</body>
</html>
